package intermedia;

import java.util.ArrayList;
import java.util.Scanner;

import semantica.SymbolTable;

public class Node {
	private String id;
	private Attributes attributes;
	public boolean visited;
	private int x, y;

	private ArrayList<Edge> edges;
	public Node next;
	public int dist;

	public Node(String _id, SymbolTable st) {
		this.id = _id;
		edges = new ArrayList<Edge>();
		attributes = new Attributes();
		attributes.addAtributes(st.getNodeAttributes());
		visited = false;
		setX(20);
		setY(20);
		next = null;
		dist=0;
	}

	public void addEdge(Edge _edge) {
		edges.add(_edge);
	}

	public void addAttribute(String _key, String _value, int line, int column) throws InvalidTypeAttributeException {
		attributes.addAtribute(_key, _value, line,column);
	}

	public String getId() {
		return id;
	}

	public Attributes getAttributes() {
		return attributes;
	}

	public void addAttributes(Attributes attr) {
		attributes.addAtributes(attr);
	}
	
	public ArrayList<Edge> getEdges(){
		return edges;
	}
	
	public void setEdgesVisited(boolean v)
	{
		for( Edge e: edges)
		{
			e.visited=v;
		}
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}
}
